<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>




        <div class="table-box tablenes">
            <div class="title">报销信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">工程名称</td><td id="enginname" class="tv colorlan" colspan="3"></td></tr>
                <tr><td class="tt">款项摘要</td><td id="zhai" class="tv colorlan"></td><td class="tt">有无发票</td><td class="tv" id="ispiao" colspan="3"></td></tr>
                <tr><td class="tt">报销金额合计(元)</td><td class="tv" id="money"></td><td class="tt">本次新增发票金额合计(元)</td><td class="tv" id="piaofee"></td></tr>
                <tr><td class="tt">可用发票金额(元)</td><td class="tv" id="piaosheng" colspan="3"></td></tr>
                <tr><td class="tt">支付方式</td><td id="incdaotype_name" class="tv"></td><td class="tt">付款对象</td><td id="fuer" class="tv"></td></tr>
                <tr><td class="tt">账户名称</td><td class="tv" id="bankzhang" colspan="3"></td></tr>
                <tr><td class="tt">账号</td><td id="banknum" class="tv"></td><td class="tt">开户行</td><td id="bankname" class="tv"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>
        <div class="table-box tablenes">
            <div class="title">支付信息(出纳)</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">支付状态</td><td class="tv" id="paystate_name"></td><td class="tt">最近支付日期</td><td class="tv" id="paylastdt"></td></tr>
                <tr><td class="tt">已支付金额(元)</td><td class="tv" id="payfee"></td><td class="tt">未支付金额(元)</td><td class="tv" id="paynofee"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">报销明细</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div class="table-box tablenes layui-hide" id="listpiaoinfo">
            <script type="text/html" id="toolbarDemo_piao">发票信息</script>
            <div class="tableShow">
                <table id="datalist_piao" lay-filter="datalist_piao"></table>
            </div>
        </div>



        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_hou_bao_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                if(engininfo){
                    $("#enginname").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                }


                $("#zhai").text(data.zhai);
                $("#ispiao").text(data.ispiao);
                $("#piaofee").text(parseFormatNum(data.piaofee));
                $("#money").text(parseFormatNum(data.money));
                $("#piaosheng").text(parseFormatNum(data.piaosheng));
                $("#fuer").text(data.fuer);
                $("#incdaotype_name").text(data.incdaotype_name);
                $("#bankzhang").text(data.bankzhang);
                $("#banknum").text(data.banknum);
                $("#bankname").text(data.bankname);
                $("#explain").text(data.explain);


                var kuaninfo = res.data.kuaninfo;
                if(kuaninfo){
                    $("#paystate_name").text(kuaninfo.paystate_name);
                    $("#paylastdt").text(kuaninfo.paylastdt);
                    $("#payfee").text(parseFormatNum(kuaninfo.payfee)).addClass('colorlan').click(function () {
                        openNavPage('查看交易明细信息','account_list/index.php?kuanid='+kuaninfo.id);
                    });
                    $("#paynofee").text(parseFormatNum(kuaninfo.paynofee));
                }

                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text,totalRow: true
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',totalRowText: '合计'}
                        ,{field: 'name', title: '报销费用名称'}
                        ,{field: 'baokuanlei_name', title: '款项类型'}
                        ,{field:'money',title:'报销金额(元)',templet: function(d){
                                return parseFormatNum(d.money);
                            }}
                        ,{field: 'dt', title: '发生日期'}
                        ,{field: 'explain', title: '款项说明'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                if(data.ispiao == '有') {
                    $("#listpiaoinfo").removeClass('layui-hide');

                    var piaotableList = table.render({
                        elem: "#datalist_piao",data:res.data.list_piao, toolbar: '#toolbarDemo_piao', page: false
                        ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                        ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text,totalRow: true
                        ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                        , cols: [[
                            {type:'numbers',title:'序号',totalRowText: '合计'}
                            ,{field: 'xiaoer', title: '销售方名称'}
                            ,{field: 'qianpiaotype_name', title: '发票类型'}
                            ,{field: 'nums', title: '发票号码'}
                            ,{field: 'kaidt', title: '开票日期'}
                            ,{field:'fee',title:'不含税金额(元)',templet: function(d){
                                    return parseFormatNum(d.fee);
                                }}
                            ,{field: 'rate', title: '税率(%)'}
                            ,{field:'ratefee',title:'税额(元)',templet: function(d){
                                    return parseFormatNum(d.ratefee);
                                }}
                            ,{field:'money',title:'价税合计(元)',templet: function(d){
                                    return parseFormatNum(d.money);
                                }}
                            ,{field: 'huidt', title: '回票日期'}
                            ,{field: 'explain', title: '备注'}
                        ]]
                        , done: function (res) {
                            soulTable.render(this);
                        }
                    });

                }



                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('hou_bao', param_id);
    });


    function show_chuinfo(chuid) {
        if(chuid > 0){
            openPage('../contract_chu/show.php?id='+chuid);
        }
    }


</script>
</body>
</html>




